package com.smartwasser.yunhtgl.apphtgl;

import android.app.Application;

import com.smartwasser.yunhtgl.apphtgl.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

public class App extends Application {
    private List<BaseActivity> mActivityList = new ArrayList<>();
    public List<String> CaseProcess1List = new ArrayList<>();
    private String system = "0";//0集团 1水环境
    private static App mApp;

    public static App getInstance() {
        return mApp;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mApp = this;
    }

    public List<String> getCaseProcess1List() {
        return CaseProcess1List;
    }

    public void setCaseProcess1List(String id) {
        if (!(CaseProcess1List.contains(id))) {
            CaseProcess1List.add(id);
        }
    }

    public void addActivity(BaseActivity activity) {
        if (!mActivityList.contains(activity)) {
            mActivityList.add(activity);
        }
    }

    public void removeActivity(BaseActivity activity) {
        if (!mActivityList.contains(activity)) {
            mActivityList.remove(activity);
        }
    }

    public void cleanActivity() {
        for (int i = 0; i < mActivityList.size(); i++) {
            BaseActivity activity = mActivityList.get(i);
            activity.finish();
        }
        mActivityList.clear();
    }

    public String getSystem() {
        return system;
    }

    public void setSystem(String system) {
        this.system = system;
    }
}